package asimes;

import java.util.Scanner;

/**
 * Created by Liangweiwei on 2016/9/12.
 *
 */
public class Main {

    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        System.out.println(longestLength(str));
    }

    public static int longestLength(String str) {
        int n = str.length();
        if (str.equals("")) {
            return 0;
        }
        int longestLength = 1;
        for (int i = 0; i < n - 1; i++) {
            int tmpLength = fromCenter(str, i, i);
            if (tmpLength > longestLength) {
                longestLength = tmpLength;
            }
            int tmpLength2 = fromCenter(str, i, i+1);
            if (tmpLength2 > longestLength) {
                longestLength = tmpLength2;
            }
        }

        return longestLength / 2;
    }

    public static int fromCenter(String str, int l, int r) {
        int n = str.length();
        while (l >= 0 && r < n && str.charAt(l) == str.charAt(r)) {
            l--;
            r++;
        }
        return r - 1 - l;
    }
}